import axios from '@/services/index';

/** 登录请求 */
interface LoginData {
    username: string;
    password: string;
}

interface LoginResponse {
    token: string;
    username: string;
}

export async function login(data: LoginData): Promise<LoginResponse> {
    const result = (await axios.post('/login', data)) as LoginResponse;
    return result;
}

/** 请求菜单列表 */
export interface MenuResponse {
    icon: string;
    label: string;
    key: string;
    children?: MenuResponse[];
}

export async function getMemuList() {
    const result = (await axios.get('/menu')) as MenuResponse[];
    return result;
}